<template>
	<view>
		<view class="titleBox">
			<text>发表评论</text>
			<text @click="sendSussfun" class="send">发表</text>
		</view>
		<uni-easyinput :clearable="true" type="textarea" :maxlength="-1" :autoHeight="true" v-model="value"
			placeholder="写评论..."></uni-easyinput>
		<view class="bottomBox">
			<uni-icons @click="showEmoji = !showEmoji" type="contact" size="35"></uni-icons>
		</view>
		<ShinnXEmoji :show="showEmoji" bottom="100rpx" @change="changeEmoji"></ShinnXEmoji>

		<uni-popup ref="popup" background-color="#fff" type="message">
			<view class="popup-content">
				<!-- <uni-icons type="checkbox" size="35"></uni-icons> -->
				<view class="text">{{tipsValue}}</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	import ShinnXEmoji from '@/uni_modules/shinn-xEmoji/components/shinn-xEmoji/shinn-xEmoji.vue'
	export default {
		components: {
			ShinnXEmoji
		},
		data() {
			return {
				showEmoji: false,
				value: '',
				tipsValue: '',
				arrvalue: []
			};
		},
		methods: {
			changeEmoji: function(event) {
				console.log(event);
				this.value = this.value + event
			},
			sendSussfun: function() {
				if (!this.value) {
					this.tipsValue = '请输入评论内容！'
					this.$refs.popup.open('center')
					return
				}

				this.tipsValue = '发表成功，审核中！'
				this.$refs.popup.open('center')
				setTimeout(() => {
					uni.navigateTo({
						url: '/pages/index/index'
					})
				}, 1000)
			}
		}
	}
</script>

<style lang="less">
	.titleBox {
		text-align: center;
		position: relative;
		padding: 10rpx 0;

		.send {
			color: blue;
			position: absolute;
			right: 2rpx;
		}
	}

	.inputBox {
		display: block;
		max-height: 80vh;
	}

	.bottomBox {
		position: fixed;
		bottom: 20rpx;
		left: 10rpx;
	}
</style>